<template>
  <view class="page_root" data-page-name="审批详情" data-page-identification="x_ky30umttem">
    <!-- UNI_APP_EXEGESIS_START NAVIGATION_TEMPLATE UNI_APP_EXEGESIS_END -->
    <!-- begin vid_xnninieto7 自定义模板_uxv7aol0n4 -->
    <u-mask :show="state.loadingShow" @click="show = false">
      <view class="abc" style="height: 100px; width: 100px;position: absolute; top: 50%; left: 50%;transform: translate(-50%, -50%); z-index: 2;">
        <u-loading :color="'red'" mode="semicircle" textSize="50" :show="state.loadingShow" size="100"></u-loading>
        <view v-if="state.loadingShow">请稍后....</view>
      </view>
    </u-mask>
    <view class="main">
      <view class="bgc-img"></view>
      <template v-if="state.isProject">
        <template v-for="(item, index) in state.projectViewList" :key="index">
          <view class="detail-content mb-15">
            <view class="detail-item border">
              <view class="detail-left border-left">{{ item.mainTitle }}</view>
            </view>
            <!--     甲方信息       -->
            <template v-if="item?.key === 'FIRST_PARTY'">
              <u-collapse
                v-for="(firstItem, fistIndex) in getProjectDetailByKey('FIRST_PARTY', 'afterValue')"
                :key="fistIndex+'FIRST_PARTY'"
                :item-style="firstBorderStyle(fistIndex, getProjectDetailByKey('FIRST_PARTY', 'afterValue').length)"
                :arrow="getProjectDetailByKey(item.key, 'changed')"
              >
                <u-collapse-item :disabled="!getProjectDetailByKey(item.key, 'changed')">
                  <template v-slot:title>
                    <view class="detail-item">
                      <view class="detail-left">角色</view>
                      <view class="detail-right">{{ firstItem.role }}</view>
                    </view>
                  </template>
                  <view class="before-style"> 修改前内容为：{{ getProjectDetailByKey('FIRST_PARTY', 'beforeValue')['role'] }} </view>
                </u-collapse-item>
                <u-collapse-item :disabled="!getProjectDetailByKey(item.key, 'changed')">
                  <template v-slot:title>
                    <view class="detail-item">
                      <view class="detail-left">甲方姓名</view>
                      <view class="detail-right">{{ firstItem.firstPartyName }}</view>
                    </view>
                  </template>
                  <view class="before-style"> 修改前内容为：{{ getProjectDetailByKey('FIRST_PARTY', 'beforeValue')['firstPartyName'] }} </view>
                </u-collapse-item>
              </u-collapse>
            </template>

            <template v-for="(subItem) in item.list" :key="subItem.key">
              <u-collapse :item-style="state.itemStyle" :arrow="getProjectDetailByKey(subItem.key, 'changed')">
                <u-collapse-item v-if="getProjectDetailByKey(subItem.key, 'changed')" :disabled="!getProjectDetailByKey(subItem.key, 'changed')" :name="subItem.key">
                  <template v-slot:title>
                    <view class="detail-item" v-if="subItem.title">
                      <view class="detail-left">{{ subItem.title }}</view>
                      <view class="detail-right">{{ getProjectDetailByKey(subItem.key) }}</view>
                    </view>
                    <view class="view-text" v-else>
                      {{ getProjectDetailByKey(subItem.key) || '无' }}
                    </view>
                  </template>
                  <view class="before-style" v-if="subItem.title"> 修改前内容为：{{ getProjectDetailByKey(subItem.key, 'beforeValue') }} </view>

                  <view class="view-text" v-else> 修改前内容为：{{ getProjectDetailByKey(subItem.key, 'beforeValue') }} </view>
                </u-collapse-item>

                <template v-else>
                  <template v-if="['COMMERCIAL_ENCLOSURE_INFO', 'SOW', 'BUDGET_ENCLOSURE'].includes(subItem.key)">
                    <view class="detail-item border" v-for="(item, index) in getProjectDetailByKey(subItem.key, 'afterValue')" :key="index">
                      <view class="detail-left ellipsis">{{ `${subItem.title}：${item.name}` }}</view>
                      <view class="detail-right" style="display: flex;align-items: center;flex-direction: row-reverse;">
                        <u-button style="width: 112rpx;height: 44rpx; font-size: 24rpx;" type="primary" :disabled="!item.url" @click="handleDownLoadFile(item)">下载</u-button>
                      </view>
                    </view>
                  </template>
                  <template v-else-if="subItem.title">
                    <view class="detail-item border">
                      <view class="detail-left" :style="{color: getProjectDetailByKey(subItem.key, 'changed') ? '#3875FF' : '#595959'}">{{ subItem.title }}</view>
                      <view class="detail-right">
                        {{ subItem.collapse ? getProjectDetailByKey(subItem.key, 'afterValue') : state.projectDetail[subItem.key] }}
                      </view>
                    </view>
                  </template>
                  <view class="detail-item border" v-else>
                    <view class="view-text">
                      {{ getProjectDetailByKey(subItem.key) }}
                    </view>
                  </view>
                </template>
              </u-collapse>
            </template>

            <template v-if="item?.key === 'changeReason'">
              <view class="view-text">
                {{ state.projectDetail[item.key] }}
              </view>
            </template>
          </view>
        </template>
        <view class="detail-item">
          <view class="fixed-button" v-if="state.processStatus === '我的待办'">
            <view class="agree-btn" @click="handleAgree">同意</view>
            <view class="cancle-btn" @click="handleCancel">驳回</view>
          </view>
          <view class="revoke-btn" v-if="state.processStatus === '我发起的' && state.status==='IN_PROCESS' " @click="handleRevokeShow">撤销</view>
        </view>
      </template>

      <template v-if="state.isEditTask">
        <view class="detail-content mb-15">
          <template v-for="(subItem, subIndex) in state.editTaskList" :key="subIndex">
            <u-collapse v-if="subItem.collapse" :item-style="state.itemStyle">
              <u-collapse-item v-if="getEditTaskByKey(subItem.key, 'changed')" :disabled="!getEditTaskByKey(subItem.key, 'changed')">
                <template v-slot:title>
                  <view class="detail-item">
                    <view class="detail-left">{{ subItem.title }}</view>
                    <view class="detail-right">{{ getEditTaskByKey(subItem.key) }}</view>
                  </view>
                </template>
                <view class="before-style"> 修改前内容为：{{ getEditTaskByKey(subItem.key, 'beforeValue') }} </view>
              </u-collapse-item>
              <view class="detail-item border" v-else>
                <view class="detail-left">{{ subItem.title }}</view>
                <view class="detail-right">
                  {{subItem.collapse ? getEditTaskByKey(subItem.key, 'afterValue') : state.editTaskDetail[subItem.key]}}
                </view>
              </view>
            </u-collapse>
            <view class="detail-item border" v-else>
              <view class="detail-left">{{ subItem.title }}</view>
              <view class="detail-right">{{ state.editTaskDetail[subItem.key] }}</view>
            </view>
          </template>
          <view class="score-content" v-if="scoreSource.length>0">
            <view class="score-title">加减分变更</view>
            <view class="score-item" v-for="(item,index) in scoreSource" :key="index">
              <view class="score-item-line">
                <view class="score-item-left">涉及角色</view>
                <view class="score-item-right">{{ item.role }}</view>
              </view>
              <view class="score-item-line">
                <view class="score-item-left">加减分类型</view>
                <view class="score-item-right">{{ item.pointTypeName }}{{ item.taskPoints }}</view>
              </view>
              <view class="score-item-line">
                <view class="score-item-left">加减分触发时间</view>
                <view class="score-item-right">{{ item.updateTime }}</view>
              </view>
              <view class="score-item-line">
                <view class="score-item-left">是否计入总分</view>
                <view class="score-item-right">{{ item.deductStatus }}</view>
              </view>
              <view class="score-item-line">
                <view class="score-item-left">操作</view>
                <view class="score-item-right"><span class="yes-no" @click="addOrReduction(item)">是否扣分</span></view>
              </view>
            </view>
          </view>
          <!-- 加减分详情 -->
        </view>
        <view class="detail-item">
          <view class="fixed-button" v-if="state.processStatus === '我的待办'">
            <view class="agree-btn" @click="handleAgree">同意</view>
            <view class="cancle-btn" @click="handleCancel">驳回</view>
          </view>
          <view class="revoke-btn" v-if="state.processStatus === '我发起的' && state.status==='IN_PROCESS' " @click="handleRevokeShow">撤销</view>
        </view>
      </template>

      <template v-if="state.isCompleteTask">
        <view class="detail-content complete-wrapper mb-15">
          <view class="detail-item">
            <view class="detail-left">审批类型</view>
            <view class="detail-right">{{ state.type }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">任务</view>
            <view class="detail-right">{{ state.taskName }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">项目</view>
            <view class="detail-right">{{ state.projectName }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">项目阶段</view>
            <view class="detail-right">{{ state.milepostName }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">任务状态</view>
            <view class="detail-right">{{ state.taskStatus }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">优先级</view>
            <view class="detail-right">{{ state.priority }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">计划开始时间</view>
            <view class="detail-right">{{ state.startTime }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">计划结束时间</view>
            <view class="detail-right">{{ state.endTime }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">实际开始时间</view>
            <view class="detail-right">{{ state.actualStarTime }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">计划工时</view>
            <view class="detail-right">{{ state.workingHours }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">实际工时</view>
            <view class="detail-right">{{ state.actualWorkHours }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">工时投入状态</view>
            <view class="detail-right">{{ state.stateInput }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">审核员</view>
            <view class="detail-right">{{ state.assessorName }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">任务参与人</view>
            <view class="detail-right">{{ state.taskParticipantStr }}</view>
          </view>
          <view style="width: 100%; margin-bottom: 10px; font-size: 14px; line-height: 2;">
            <view class="detail-left">甲方工作事项</view>
            <view v-for="(item,index) in state.taskRemarks" :key="index">{{ item }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">提交人</view>
            <view class="detail-right">{{ state.creadBy }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">提交时间</view>
            <view class="detail-right">{{ state.lastModifiedDate }}</view>
          </view>
          <!-- 新-完成标准 -->
          <view class="ok-item">
            <view class="detail-left">完成标准</view>
            <view class="ok-item-tip" v-for="(item, index) in state.okList">
              <u-checkbox v-model="item.selected" disabled="true">{{ item.content }}</u-checkbox>
            </view>
          </view>
          <view class="ok-item">
            <view class="detail-left">SOP</view>
            <view class="ok-item-tip" v-for="(item, index) in state.sopList">
              <u-checkbox v-model="item.selected" disabled="true">{{ item.content }}</u-checkbox>
            </view>
          </view>
          <!-- 新-审核标准 -->

          <view class="img-content" v-if="state.ppmEnclosureInfoList.length > 0 && hasImageInList()">
            <view class="img-title detail-left">图片：</view>

            <view class="image-container">
              <view class="img-content-item" v-for="(item, index) in state.ppmEnclosureInfoList" :key="index">
                <u-image class="image-every" v-if="isImage(item.url)" width="100px" height="100px" :src="item.url" @click="previewImage(item.url)"></u-image>
              </view>
            </view>
          </view>
          <view class="line-bottom"></view>
          <view>
            <view class="detail-left">审核标准及注意事项：</view>
            <view class="check-item-tip" v-for="(item, index) in state.checkList" :key="index">
              {{ item.content }}
            </view>
          </view>
        </view>
        <view class="detail-item">
          <view class="fixed-button" v-if="state.processStatus === '我的待办'">
            <view class="agree-btn" @click="handleAgree">同意</view>
            <view class="cancle-btn" @click="handleCancel">驳回</view>
          </view>
          <view class="revoke-btn" v-if="state.processStatus === '我发起的' && state.status==='IN_PROCESS' " @click="handleRevokeShow">撤销</view>
        </view>
      </template>
      <!-- 新日报审批 -->
      <template v-if="state.isDaily">
        <!-- 项目 -->
        <view class="detail-content complete-wrapper mb-15" v-for="(item,index) in projectDailyState" :key="index">
          <view class="detail-item">
            <view class="detail-left">审批类型</view>
            <view class="detail-right">项目工时审批</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">项目名称</view>
            <view class="detail-right">{{ item.projectName }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">任务名称</view>
            <view class="detail-right">{{ item.taskName }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">工时</view>
            <view class="detail-right">{{ item.workingHours }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">风险描述</view>
            <view class="detail-right">{{ item.riskDescription }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">解决方案</view>
            <view class="detail-right">{{ item.solution }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">提交人</view>
            <view class="detail-right">{{ item.submissionUser }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">工时对应时间</view>
            <view class="detail-right">{{ item.dailyDate }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">提交审批时间</view>
            <view class="detail-right">{{ item.submissionTime }}</view>
          </view>
        </view>
        <!-- 任务 -->
        <view class="detail-content complete-wrapper mb-15" v-for="(item,index) in dailyState" :key="index">
          <view class="detail-item">
            <view class="detail-left">审批类型</view>
            <view class="detail-right">任务工时审批</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">项目名称</view>
            <view class="detail-right">{{ item.projectName }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">任务名称</view>
            <view class="detail-right">{{ item.taskName }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">工时</view>
            <view class="detail-right">{{ item.workingHours }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">风险描述</view>
            <view class="detail-right">{{ item.riskDescription }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">解决方案</view>
            <view class="detail-right">{{ item.solution }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">提交人</view>
            <view class="detail-right">{{ item.submissionUser }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">工时对应时间</view>
            <view class="detail-right">{{ item.dailyDate }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">提交审批时间</view>
            <view class="detail-right">{{ item.submissionTime }}</view>
          </view>
        </view>
        <!-- 其他 -->
        <view class="detail-content complete-wrapper mb-15" v-for="(item,index) in otherState" :key="index">
          <view class="detail-item">
            <view class="detail-left">审批类型</view>
            <view class="detail-right">其他日报工时审批</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">工作类型</view>
            <view class="detail-right">{{ item.projectName }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">工时</view>
            <view class="detail-right">{{ item.workingHours }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">提交人</view>
            <view class="detail-right">{{ item.submissionUser }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">工时对应时间</view>
            <view class="detail-right">{{ item.dailyDate }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">提交审批时间</view>
            <view class="detail-right">{{ item.submissionTime }}</view>
          </view>
        </view>
        <!-- 请假 -->
        <view class="detail-content complete-wrapper mb-15" v-for="(item,index) in leaveState" :key="index">
          <view class="detail-item">
            <view class="detail-left">审批类型</view>
            <view class="detail-right">休假申请</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">工作类型</view>
            <view class="detail-right">休假</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">工时</view>
            <view class="detail-right">{{ item.workingHours }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">提交人</view>
            <view class="detail-right">{{ item.submissionUser }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">休假时间范围</view>
            <view class="detail-right">{{ item.dailyDate }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">提交审批时间</view>
            <view class="detail-right">{{ item.submissionTime }}</view>
          </view>
        </view>
        <view class="detail-item">
          <view class="fixed-button" v-if="state.processStatus === '我的待办'">
            <view class="agree-btn" @click="handleAgree">同意</view>
            <view class="cancle-btn" @click="handleCancel">驳回</view>
          </view>
          <view class="revoke-btn" v-if="state.processStatus === '我发起的' && state.status==='IN_PROCESS' " @click="handleRevokeShow">撤销</view>
        </view>

      </template>
      <!-- 完成行动项任务审批详情 -->
      <template v-if="state.isActionOk">
        <view class="detail-content complete-wrapper mb-15">
          <view class="detail-item">
            <view class="detail-left">审批类型</view>
            <view class="detail-right">{{ state.type }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">任务</view>
            <view class="detail-right">{{ state.completeActionTaskDetail.actionTaskName }}</view>
          </view>
          <view class="detail-item">
      <view class="detail-left">项目</view>
      <view class="detail-right">{{ state.completeActionTaskDetail.projectNames }}</view>
    </view>

    <view class="detail-item">
      <view class="detail-left">任务状态</view>
      <view class="detail-right">{{ state.completeActionTaskDetail.taskStatus }}</view>
    </view>
    <view class="detail-item">
      <view class="detail-left">计划开始时间</view>
      <view class="detail-right">{{ state.completeActionTaskDetail.startTime }}</view>
    </view>
    <view class="detail-item">
      <view class="detail-left">计划结束时间</view>
      <view class="detail-right">{{ state.completeActionTaskDetail.endTime }}</view>
    </view>
    <view class="detail-item">
      <view class="detail-left">实际开始时间</view>
      <view class="detail-right">{{ state.completeActionTaskDetail.examPassTime }}</view>
    </view>
    <view class="detail-item">
      <view class="detail-left">计划工时</view>
      <view class="detail-right">{{ state.completeActionTaskDetail.workingHours }}</view>
    </view>
    <view class="detail-item">
      <view class="detail-left">实际工时</view>
      <view class="detail-right">{{ state.completeActionTaskDetail.actualWorkHours }}</view>
    </view>

    <view class="detail-item">
      <view class="detail-left">审核员</view>
      <view class="detail-right">{{ state.completeActionTaskDetail.assessorName }}</view>
    </view>
    <view class="detail-item">
      <view class="detail-left">任务执行人</view>
      <view class="detail-right">{{ state.completeActionTaskDetail.taskParticipant }}</view>
    </view>
    <view class="detail-item">
      <view class="detail-left">PMO</view>
      <view class="detail-right">{{ state.completeActionTaskDetail.projectManagementOffice }}</view>
    </view>
    <view class="detail-item">
      <view class="detail-left">提交人</view>
      <view class="detail-right">{{ state.completeActionTaskDetail.submittionUser }}</view>
    </view>
    <view class="detail-item">
      <view class="detail-left">完成标准</view>
      <view class="detail-right">{{ state.completeActionTaskDetail.finishStandard }}</view>
    </view>
    <view class="detail-item">
      <view class="detail-left">提交时间</view>
      <view class="detail-right">{{ state.completeActionTaskDetail.submittionTime }}</view>
    </view>

          <view class="img-content" >
            <view class="img-title detail-left">图片：</view>

            <view class="image-container">
              <view class="img-content-item" v-for="(item, index) in state.completeActionTaskDetail.ppmEnclosureInfoList" :key="index">
                <u-image class="image-every" v-if="isImage(item.url)" width="100px" height="100px" :src="item.url" @click="previewImage(item.url)"></u-image>
              </view>
            </view>
          </view>
        </view>
        <view class="detail-item">
          <view class="fixed-button" v-if="state.processStatus === '我的待办'">
            <view class="agree-btn" @click="handleAgree">同意</view>
            <view class="cancle-btn" @click="handleCancel">驳回</view>
          </view>
          <view class="revoke-btn" v-if="state.processStatus === '我发起的' && state.status==='IN_PROCESS' " @click="handleRevokeShow">撤销</view>
        </view>
      </template>
      <!-- 编辑行动项任务审批详情 -->
      <template v-if="state.isEditActionTask">
        <view class="detail-content mb-15">
          <template v-for="(subItem, subIndex) in state.editActionTaskList" :key="subIndex">
            <u-collapse v-if="subItem.collapse" :item-style="state.itemStyle">
              <u-collapse-item v-if="getEditActionTaskByKey(subItem.key, 'changed')" :disabled="!getEditActionTaskByKey(subItem.key, 'changed')">
                <template v-slot:title>
                  <view class="detail-item">
                    <view class="detail-left">{{ subItem.title }}</view>
                    <view class="detail-right">{{ getEditActionTaskByKey(subItem.key) }}</view>
                  </view>
                </template>
                <view class="before-style"> 修改前内容为：{{ getEditActionTaskByKey(subItem.key, 'beforeValue') }} </view>
              </u-collapse-item>
              <view class="detail-item border" v-else>
                <view class="detail-left">{{ subItem.title }}</view>
                <view class="detail-right">
                  {{subItem.collapse ? getEditActionTaskByKey(subItem.key, 'afterValue') : state.editActionTaskDetail[subItem.key]}}
                </view>
              </view>
            </u-collapse>
            <view class="detail-item border" v-else>
              <view class="detail-left">{{ subItem.title }}</view>
              <view class="detail-right">{{ state.editActionTaskDetail[subItem.key] }}</view>
            </view>
          </template>
          <view class="score-content" v-if="scoreSource.length>0">
            <view class="score-title">加减分变更</view>
            <view class="score-item" v-for="(item,index) in scoreSource" :key="index">
              <view class="score-item-line">
                <view class="score-item-left">涉及角色</view>
                <view class="score-item-right">{{ item.role }}</view>
              </view>
              <view class="score-item-line">
                <view class="score-item-left">加减分类型</view>
                <view class="score-item-right">{{ item.pointTypeName }}{{ item.taskPoints }}</view>
              </view>
              <view class="score-item-line">
                <view class="score-item-left">加减分触发时间</view>
                <view class="score-item-right">{{ item.updateTime }}</view>
              </view>
              <view class="score-item-line">
                <view class="score-item-left">是否计入总分</view>
                <view class="score-item-right">{{ item.deductStatus }}</view>
              </view>
              <view class="score-item-line">
                <view class="score-item-left">操作</view>
                <view class="score-item-right"><span class="yes-no" @click="addOrReduction(item)">是否扣分</span></view>
              </view>
            </view>
          </view>
          <!-- 加减分详情 -->
        </view>
        <view class="detail-item">
          <view class="fixed-button" v-if="state.processStatus === '我的待办'">
            <view class="agree-btn" @click="handleAgree">同意</view>
            <view class="cancle-btn" @click="handleCancel">驳回</view>
          </view>
          <view class="revoke-btn" v-if="state.processStatus === '我发起的' && state.status==='IN_PROCESS' " @click="handleRevokeShow">撤销</view>
        </view>
      </template>
      <!-- 编辑行动项任务审批详情 -->
       <!-- 批量延时 -->
       <template v-if="state.isBatchDelay">
        <view class="detail-content batch-deily mb-15">
       <view class="one-line">模板项目-任务-批量延时</view>
       <view class="detail-item">
            <view class="detail-left">项目名称</view>
            <view class="detail-right">{{state.batchDelayDetail.projectName}}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">项目总监</view>
            <view class="detail-right">{{state.batchDelayDetail.projectDirector}}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">PMO</view>
            <view class="detail-right">{{state.batchDelayDetail.projectManagementOffice}}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">提交人</view>
            <view class="detail-right">{{state.batchDelayDetail.submittor}}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">提交时间</view>
            <view class="detail-right">{{state.batchDelayDetail.submittionTime}}</view>
          </view>
        </view>
       <view v-if="state.batchDelayDetail.taskBatchDelayTaskInfoDtoList && state.batchDelayDetail.taskBatchDelayTaskInfoDtoList.length>0" >
        <view class="detail-content batch-deily mb-15" v-for="(item,index) in state.batchDelayDetail.taskBatchDelayTaskInfoDtoList" :key=index>
          <view class="one-line">变更任务详情</view>
       <view class="detail-item">
            <view class="detail-left">任务名称</view>
            <view class="detail-right">{{ item.taskName }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">变更前计划开始时间</view>
            <view class="detail-right before">{{ item.originStartTime }}</view>
           
          </view>
          <view class="detail-item">
            <view class="detail-left">变更后计划开始时间</view>
            <view class="detail-right">{{ item.newStartTime }}</view>
          </view>
          <view class="detail-item">
            <view class="detail-left">变更前计划结束时间</view>
            <view class="detail-right before">{{ item.originEndTime }}</view>
           
          </view>
          <view class="detail-item">
            <view class="detail-left">变更后计划结束时间</view>
            <view class="detail-right">{{ item.newEndTime }}</view>
          </view>
        </view>
       </view>
        <view class="detail-item">
          <view class="fixed-button" v-if="state.processStatus === '我的待办'">
            <view class="agree-btn" @click="handleAgree">同意</view>
            <view class="cancle-btn" @click="handleCancel">驳回</view>
          </view>
          <view class="revoke-btn" v-if="state.processStatus === '我发起的' && state.status==='IN_PROCESS' " @click="handleRevokeShow">撤销</view>
        </view>
      </template>
       <!-- 批量延时 -->
    </view>

    <u-modal
      v-model="state.confirmShow"
      :title-style="{ color: '#008BFF' }"
      :showCancelButton="true"
      confirm-color="#008BFF"
      cancel-color="#595959"
      title="同意"
      :titleStyle="{ color: '#008BFF' }"
      :contentStyle="modalStyle"
      @confirm="handleConfirm"
      @cancel="aCancel"
    >
      <view class="slot-content">
        <textarea style="width: 100%; margin-top: 12px; color: #bebebe;" v-model="state.confirmTip" placeholder="请输入留言内容"></textarea>
      </view>
    </u-modal>
    <u-modal
      v-model="state.cancelShow"
      :title-style="{ color: '#008BFF' }"
      :showCancelButton="true"
      confirm-color="#008BFF"
      cancel-color="#595959"
      title="驳回"
      :contentStyle="modalStyle"
      @confirm="handleReject"
      @cancel="bCancel"
    >
      <view class="slot-content">
        <textarea style="width: 100%; margin-top: 12px; " v-model="state.cancelTip" placeholder="请输入留言内容"></textarea>
      </view>
    </u-modal>
    <u-modal
      v-model="state.revokeShow"
      :content="content"
      @confirm="handleRevoke"
      class="revoke"
      :contentStyle="modalStyle"
      @cancel="state.revokeShow = false"
      :showCancelButton="true"
      :content-style="{border:'none'}"
    >
      <div style="padding: 12px;">
        <textarea style="width: 100%; margin-top: 12px; " v-model="state.revokeMsg" placeholder="请输入留言内容"></textarea>
      </div>
    </u-modal>

    <!-- 新加减分 -->
    <u-modal
      v-model="scoreVisible"
      :showCancelButton="true"
      confirm-color="#008BFF"
      cancel-color="#595959"
      title="请确认变更后是否保留已发生扣分"
      :titleStyle="{ color: '#262626',fontWeight:600 }"
      :contentStyle="modalStyle"
      @confirm="yesScore"
      @cancel="noScore"
    >
      <view class="slot-content">
        <view style="padding: 15px 0 0 0">
          <view class="tip-t"
            >选择<span style="color: #3875ff;font-weight: 500;">确认</span>，代表保留目前已扣除的分数，并通过变更后的任务计划完成日期重新计算延期天数，二者相加可能造成重复扣分。</view
          >
          <view class="tip-t">选择<span style="color: #3875ff;font-weight: 500;">取消</span>，代表不保留目前已扣除的分数，系统将根据本次审批的计划完成日期重新判断扣分，不额外加入已扣分数。</view>
          <view class="tip-b"> <span style="color: #595959;font-weight: 500;">例：</span>原定4月1日完成的任务延期3天，变更后仍为4月1日完成。确认则对延期3天扣分2次，取消对延期3天扔扣分1次。 </view>
          <view class="tip-b">原定4月1日完成的任务延期3天，变更后为4月4日完成未延期。确认仅保留先前延期3天扣分1次，取消后由于4月4日未延期不扣分。</view>
        </view>
      </view>
    </u-modal>
    <!-- 新加减分 -->
    <!-- end vid_xnninieto7 自定义模板_uxv7aol0n4 -->
  </view>
</template>
<script setup>

  import {
    ref,reactive,toRaw,markRaw,
    watch,computed,
    onBeforeMount,onMounted,onBeforeUnmount,onUnmounted,onActivated,onDeactivated,getCurrentInstance
  } from "vue";
  import { useRoute } from 'vue-router';
  const route = useRoute();
  import { get, post, put, del, request, requestWithHeaders } from '@/utils/http/Axios';
  import { cloneDeep, localGet, traversalTreeStructure, set, checkCaseCondition, throttle, merge, debounce, getGridStyle, getCellRenderAble } from '@/utils/index';
  import { isEqual, isNullOrEmpty, isEmptyArr, isArray, isEmpty, isNullOrUnDef, isContained } from '@/utils/is';
  import { CovertOptions, getChartsDataSourceConvert } from '@/utils/chart';
  import { propertyFormatByNumber, propertyFormatByPercentage, propertyFormatByDate } from '@/utils/format';
  import { FormFormat } from '@/utils/formFormat'
  import { customAddWaterMarkFunc, generateWaterMarkText } from '@/utils/addWaterMark';
  import dayjs from 'dayjs';
  import hashSum from 'hash-sum';
  import { handleRedirect, } from '@/utils/common';
  import { onPullDownRefresh, onLoad, onReady, onShow, onHide, onPageScroll, onUnload } from '@dcloudio/uni-app';
  /*** UNI_APP_EXEGESIS ***
  import { handleRedirect, permission, parseJson } from '@/utils/common';
  import { onPullDownRefresh, onLoad, onReady, onShow, onHide, onPageScroll, onUnload } from '@dcloudio/uni-app';
  import { BroadcastMessage } from '@/utils/BroadcastMessage';
  import { sendToken } from "@/hooks/useIframeToken";
  *** UNI_APP_EXEGESIS ***/


  // ---------------------------- 属性定义 ----------------------------
  const sourceId = "page3000000259"

    // 是否显示菜单按钮
    const isMenuIconShow = false;
    // NAVIGATION_MENU
    const handleShowNavigation = ()=>{};

    let isProcessState = ref(false);


  const setTimeOutList = [];


      const vid_xnninieto7_props = reactive({
        code: "   <u-mask :show=\"state.loadingShow\" @click=\"show = false\">\n      <view class=\"abc\" style=\"height: 100px; width: 100px;position: absolute; top: 50%; left: 50%;transform: translate(-50%, -50%); z-index: 2;\">\n        <u-loading :color=\"'red'\" mode=\"semicircle\" textSize=\"50\" :show=\"state.loadingShow\" size=\"100\"></u-loading>\n        <view v-if=\"state.loadingShow\">请稍后....</view>\n      </view>\n    </u-mask>\n    <view class=\"main\">\n      <view class=\"bgc-img\"></view>\n      <template v-if=\"state.isProject\">\n        <template v-for=\"(item, index) in state.projectViewList\" :key=\"index\">\n          <view class=\"detail-content mb-15\">\n            <view class=\"detail-item border\">\n              <view class=\"detail-left border-left\">{{ item.mainTitle }}</view>\n            </view>\n            <!--     甲方信息       -->\n            <template v-if=\"item?.key === 'FIRST_PARTY'\">\n              <u-collapse\n                v-for=\"(firstItem, fistIndex) in getProjectDetailByKey('FIRST_PARTY', 'afterValue')\"\n                :key=\"fistIndex+'FIRST_PARTY'\"\n                :item-style=\"firstBorderStyle(fistIndex, getProjectDetailByKey('FIRST_PARTY', 'afterValue').length)\"\n                :arrow=\"getProjectDetailByKey(item.key, 'changed')\"\n              >\n                <u-collapse-item :disabled=\"!getProjectDetailByKey(item.key, 'changed')\">\n                  <template v-slot:title>\n                    <view class=\"detail-item\">\n                      <view class=\"detail-left\">角色</view>\n                      <view class=\"detail-right\">{{ firstItem.role }}</view>\n                    </view>\n                  </template>\n                  <view class=\"before-style\"> 修改前内容为：{{ getProjectDetailByKey('FIRST_PARTY', 'beforeValue')['role'] }} </view>\n                </u-collapse-item>\n                <u-collapse-item :disabled=\"!getProjectDetailByKey(item.key, 'changed')\">\n                  <template v-slot:title>\n                    <view class=\"detail-item\">\n                      <view class=\"detail-left\">甲方姓名</view>\n                      <view class=\"detail-right\">{{ firstItem.firstPartyName }}</view>\n                    </view>\n                  </template>\n                  <view class=\"before-style\"> 修改前内容为：{{ getProjectDetailByKey('FIRST_PARTY', 'beforeValue')['firstPartyName'] }} </view>\n                </u-collapse-item>\n              </u-collapse>\n            </template>\n\n            <template v-for=\"(subItem) in item.list\" :key=\"subItem.key\">\n              <u-collapse :item-style=\"state.itemStyle\" :arrow=\"getProjectDetailByKey(subItem.key, 'changed')\">\n                <u-collapse-item v-if=\"getProjectDetailByKey(subItem.key, 'changed')\" :disabled=\"!getProjectDetailByKey(subItem.key, 'changed')\" :name=\"subItem.key\">\n                  <template v-slot:title>\n                    <view class=\"detail-item\" v-if=\"subItem.title\">\n                      <view class=\"detail-left\">{{ subItem.title }}</view>\n                      <view class=\"detail-right\">{{ getProjectDetailByKey(subItem.key) }}</view>\n                    </view>\n                    <view class=\"view-text\" v-else>\n                      {{ getProjectDetailByKey(subItem.key) || '无' }}\n                    </view>\n                  </template>\n                  <view class=\"before-style\" v-if=\"subItem.title\"> 修改前内容为：{{ getProjectDetailByKey(subItem.key, 'beforeValue') }} </view>\n\n                  <view class=\"view-text\" v-else> 修改前内容为：{{ getProjectDetailByKey(subItem.key, 'beforeValue') }} </view>\n                </u-collapse-item>\n\n                <template v-else>\n                  <template v-if=\"['COMMERCIAL_ENCLOSURE_INFO', 'SOW', 'BUDGET_ENCLOSURE'].includes(subItem.key)\">\n                    <view class=\"detail-item border\" v-for=\"(item, index) in getProjectDetailByKey(subItem.key, 'afterValue')\" :key=\"index\">\n                      <view class=\"detail-left ellipsis\">{{ `${subItem.title}：${item.name}` }}</view>\n                      <view class=\"detail-right\" style=\"display: flex;align-items: center;flex-direction: row-reverse;\">\n                        <u-button style=\"width: 112rpx;height: 44rpx; font-size: 24rpx;\" type=\"primary\" :disabled=\"!item.url\" @click=\"handleDownLoadFile(item)\">下载</u-button>\n                      </view>\n                    </view>\n                  </template>\n                  <template v-else-if=\"subItem.title\">\n                    <view class=\"detail-item border\">\n                      <view class=\"detail-left\" :style=\"{color: getProjectDetailByKey(subItem.key, 'changed') ? '#3875FF' : '#595959'}\">{{ subItem.title }}</view>\n                      <view class=\"detail-right\">\n                        {{ subItem.collapse ? getProjectDetailByKey(subItem.key, 'afterValue') : state.projectDetail[subItem.key] }}\n                      </view>\n                    </view>\n                  </template>\n                  <view class=\"detail-item border\" v-else>\n                    <view class=\"view-text\">\n                      {{ getProjectDetailByKey(subItem.key) }}\n                    </view>\n                  </view>\n                </template>\n              </u-collapse>\n            </template>\n\n            <template v-if=\"item?.key === 'changeReason'\">\n              <view class=\"view-text\">\n                {{ state.projectDetail[item.key] }}\n              </view>\n            </template>\n          </view>\n        </template>\n        <view class=\"detail-item\">\n          <view class=\"fixed-button\" v-if=\"state.processStatus === '我的待办'\">\n            <view class=\"agree-btn\" @click=\"handleAgree\">同意</view>\n            <view class=\"cancle-btn\" @click=\"handleCancel\">驳回</view>\n          </view>\n          <view class=\"revoke-btn\" v-if=\"state.processStatus === '我发起的' && state.status==='IN_PROCESS' \" @click=\"handleRevokeShow\">撤销</view>\n        </view>\n      </template>\n\n      <template v-if=\"state.isEditTask\">\n        <view class=\"detail-content mb-15\">\n          <template v-for=\"(subItem, subIndex) in state.editTaskList\" :key=\"subIndex\">\n            <u-collapse v-if=\"subItem.collapse\" :item-style=\"state.itemStyle\">\n              <u-collapse-item v-if=\"getEditTaskByKey(subItem.key, 'changed')\" :disabled=\"!getEditTaskByKey(subItem.key, 'changed')\">\n                <template v-slot:title>\n                  <view class=\"detail-item\">\n                    <view class=\"detail-left\">{{ subItem.title }}</view>\n                    <view class=\"detail-right\">{{ getEditTaskByKey(subItem.key) }}</view>\n                  </view>\n                </template>\n                <view class=\"before-style\"> 修改前内容为：{{ getEditTaskByKey(subItem.key, 'beforeValue') }} </view>\n              </u-collapse-item>\n              <view class=\"detail-item border\" v-else>\n                <view class=\"detail-left\">{{ subItem.title }}</view>\n                <view class=\"detail-right\">\n                  {{subItem.collapse ? getEditTaskByKey(subItem.key, 'afterValue') : state.editTaskDetail[subItem.key]}}\n                </view>\n              </view>\n            </u-collapse>\n            <view class=\"detail-item border\" v-else>\n              <view class=\"detail-left\">{{ subItem.title }}</view>\n              <view class=\"detail-right\">{{ state.editTaskDetail[subItem.key] }}</view>\n            </view>\n          </template>\n          <view class=\"score-content\" v-if=\"scoreSource.length>0\">\n            <view class=\"score-title\">加减分变更</view>\n            <view class=\"score-item\" v-for=\"(item,index) in scoreSource\" :key=\"index\">\n              <view class=\"score-item-line\">\n                <view class=\"score-item-left\">涉及角色</view>\n                <view class=\"score-item-right\">{{ item.role }}</view>\n              </view>\n              <view class=\"score-item-line\">\n                <view class=\"score-item-left\">加减分类型</view>\n                <view class=\"score-item-right\">{{ item.pointTypeName }}{{ item.taskPoints }}</view>\n              </view>\n              <view class=\"score-item-line\">\n                <view class=\"score-item-left\">加减分触发时间</view>\n                <view class=\"score-item-right\">{{ item.updateTime }}</view>\n              </view>\n              <view class=\"score-item-line\">\n                <view class=\"score-item-left\">是否计入总分</view>\n                <view class=\"score-item-right\">{{ item.deductStatus }}</view>\n              </view>\n              <view class=\"score-item-line\">\n                <view class=\"score-item-left\">操作</view>\n                <view class=\"score-item-right\"><span class=\"yes-no\" @click=\"addOrReduction(item)\">是否扣分</span></view>\n              </view>\n            </view>\n          </view>\n                  <!-- 加减分详情 -->\n        </view>\n        <view class=\"detail-item\">\n          <view class=\"fixed-button\" v-if=\"state.processStatus === '我的待办'\">\n            <view class=\"agree-btn\" @click=\"handleAgree\">同意</view>\n            <view class=\"cancle-btn\" @click=\"handleCancel\">驳回</view>\n          </view>\n          <view class=\"revoke-btn\" v-if=\"state.processStatus === '我发起的' && state.status==='IN_PROCESS' \" @click=\"handleRevokeShow\">撤销</view>\n        </view>\n      </template>\n\n      <template v-if=\"state.isCompleteTask\">\n        <view class=\"detail-content complete-wrapper mb-15\">\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">审批类型</view>\n            <view class=\"detail-right\">{{ state.type }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">任务</view>\n            <view class=\"detail-right\">{{ state.taskName }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">项目</view>\n            <view class=\"detail-right\">{{ state.projectName }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">项目阶段</view>\n            <view class=\"detail-right\">{{ state.milepostName }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">任务状态</view>\n            <view class=\"detail-right\">{{ state.taskStatus }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">优先级</view>\n            <view class=\"detail-right\">{{ state.priority }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">计划开始时间</view>\n            <view class=\"detail-right\">{{ state.startTime }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">计划结束时间</view>\n            <view class=\"detail-right\">{{ state.endTime }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">实际开始时间</view>\n            <view class=\"detail-right\">{{ state.actualStarTime }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">计划工时</view>\n            <view class=\"detail-right\">{{ state.workingHours }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">实际工时</view>\n            <view class=\"detail-right\">{{ state.actualWorkHours }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">工时投入状态</view>\n            <view class=\"detail-right\">{{ state.stateInput }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">审核员</view>\n            <view class=\"detail-right\">{{ state.assessorName }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">任务参与人</view>\n            <view class=\"detail-right\">{{ state.taskParticipantStr }}</view>\n          </view>\n          <view style=\"width: 100%; margin-bottom: 10px; font-size: 14px; line-height: 2;\">\n            <view class=\"detail-left\">甲方工作事项</view>\n            <view v-for=\"(item,index) in state.taskRemarks\" :key=\"index\">{{ item }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">提交人</view>\n            <view class=\"detail-right\">{{ state.creadBy }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">提交时间</view>\n            <view class=\"detail-right\">{{ state.lastModifiedDate }}</view>\n          </view>\n          <!-- 新-完成标准 -->\n          <view class=\"ok-item\">\n            <view class=\"detail-left\">完成标准</view>\n            <view class=\"ok-item-tip\" v-for=\"(item, index) in state.okList\">\n              <u-checkbox v-model=\"item.selected\" disabled=\"true\">{{ item.content }}</u-checkbox>\n            </view>\n          </view>\n          <view class=\"ok-item\">\n            <view class=\"detail-left\">SOP</view>\n            <view class=\"ok-item-tip\" v-for=\"(item, index) in state.sopList\">\n              <u-checkbox v-model=\"item.selected\" disabled=\"true\">{{ item.content }}</u-checkbox>\n            </view>\n          </view>\n          <!-- 新-审核标准 -->\n\n          <view class=\"img-content\" v-if=\"state.ppmEnclosureInfoList.length > 0 && hasImageInList()\">\n            <view class=\"img-title detail-left\">图片：</view>\n\n            <view class=\"image-container\">\n              <view class=\"img-content-item\" v-for=\"(item, index) in state.ppmEnclosureInfoList\" :key=\"index\">\n                <u-image class=\"image-every\" v-if=\"isImage(item.url)\" width=\"100px\" height=\"100px\" :src=\"item.url\" @click=\"previewImage(item.url)\"></u-image>\n              </view>\n            </view>\n          </view>\n          <view class=\"line-bottom\"></view>\n          <view>\n            <view class=\"detail-left\">审核标准及注意事项：</view>\n            <view class=\"check-item-tip\" v-for=\"(item, index) in state.checkList\" :key=\"index\">\n              {{ item.content }}\n            </view>\n          </view>\n        </view>\n        <view class=\"detail-item\">\n          <view class=\"fixed-button\" v-if=\"state.processStatus === '我的待办'\">\n            <view class=\"agree-btn\" @click=\"handleAgree\">同意</view>\n            <view class=\"cancle-btn\" @click=\"handleCancel\">驳回</view>\n          </view>\n          <view class=\"revoke-btn\" v-if=\"state.processStatus === '我发起的' && state.status==='IN_PROCESS' \" @click=\"handleRevokeShow\">撤销</view>\n        </view>\n      </template>\n            <!-- 新日报审批 -->\n      <template v-if=\"state.isDaily\">\n        <!-- 项目 -->\n        <view class=\"detail-content complete-wrapper mb-15\" v-for=\"(item,index) in projectDailyState\" :key=\"index\">\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">审批类型</view>\n            <view class=\"detail-right\">项目工时审批</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">项目名称</view>\n            <view class=\"detail-right\">{{ item.projectName }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">任务名称</view>\n            <view class=\"detail-right\">{{ item.taskName }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">工时</view>\n            <view class=\"detail-right\">{{ item.workingHours }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">风险描述</view>\n            <view class=\"detail-right\">{{ item.riskDescription }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">解决方案</view>\n            <view class=\"detail-right\">{{ item.solution }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">提交人</view>\n            <view class=\"detail-right\">{{ item.submissionUser }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">工时对应时间</view>\n            <view class=\"detail-right\">{{ item.dailyDate }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">提交审批时间</view>\n            <view class=\"detail-right\">{{ item.submissionTime }}</view>\n          </view>\n        </view>\n        <!-- 任务 -->\n        <view class=\"detail-content complete-wrapper mb-15\" v-for=\"(item,index) in dailyState\" :key=\"index\">\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">审批类型</view>\n            <view class=\"detail-right\">任务工时审批</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">项目名称</view>\n            <view class=\"detail-right\">{{ item.projectName }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">任务名称</view>\n            <view class=\"detail-right\">{{ item.taskName }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">工时</view>\n            <view class=\"detail-right\">{{ item.workingHours }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">风险描述</view>\n            <view class=\"detail-right\">{{ item.riskDescription }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">解决方案</view>\n            <view class=\"detail-right\">{{ item.solution }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">提交人</view>\n            <view class=\"detail-right\">{{ item.submissionUser }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">工时对应时间</view>\n            <view class=\"detail-right\">{{ item.dailyDate }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">提交审批时间</view>\n            <view class=\"detail-right\">{{ item.submissionTime }}</view>\n          </view>\n        </view>\n        <!-- 其他 -->\n        <view class=\"detail-content complete-wrapper mb-15\" v-for=\"(item,index) in otherState\" :key=\"index\">\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">审批类型</view>\n            <view class=\"detail-right\">其他日报工时审批</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">工作类型</view>\n            <view class=\"detail-right\">{{ item.projectName }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">工时</view>\n            <view class=\"detail-right\">{{ item.workingHours }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">提交人</view>\n            <view class=\"detail-right\">{{ item.submissionUser }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">工时对应时间</view>\n            <view class=\"detail-right\">{{ item.dailyDate }}</view>\n          </view>\n          <view class=\"detail-item\">\n            <view class=\"detail-left\">提交审批时间</view>\n            <view class=\"detail-right\">{{ item.submissionTime }}</view>\n          </view>\n        </view>\n        <view class=\"detail-item\">\n          <view class=\"fixed-button\" v-if=\"state.processStatus === '我的待办'\">\n            <view class=\"agree-btn\" @click=\"handleAgree\">同意</view>\n            <view class=\"cancle-btn\" @click=\"handleCancel\">驳回</view>\n          </view>\n          <view class=\"revoke-btn\" v-if=\"state.processStatus === '我发起的' && state.status==='IN_PROCESS' \" @click=\"handleRevokeShow\">撤销</view>\n        </view>\n      </template>\n    </view>\n\n    <u-modal\n      v-model=\"state.confirmShow\"\n      :title-style=\"{ color: '#008BFF' }\"\n      :showCancelButton=\"true\"\n      confirm-color=\"#008BFF\"\n      cancel-color=\"#595959\"\n      title=\"同意\"\n      :titleStyle=\"{ color: '#008BFF' }\"\n      :contentStyle=\"modalStyle\"\n      @confirm=\"handleConfirm\"\n      @cancel=\"aCancel\"\n    >\n      <view class=\"slot-content\">\n        <textarea style=\"width: 100%; margin-top: 12px; color: #bebebe;\" v-model=\"state.confirmTip\" placeholder=\"请输入留言内容\"></textarea>\n      </view>\n    </u-modal>\n    <u-modal\n      v-model=\"state.cancelShow\"\n      :title-style=\"{ color: '#008BFF' }\"\n      :showCancelButton=\"true\"\n      confirm-color=\"#008BFF\"\n      cancel-color=\"#595959\"\n      title=\"驳回\"\n      :contentStyle=\"modalStyle\"\n      @confirm=\"handleReject\"\n      @cancel=\"bCancel\"\n    >\n      <view class=\"slot-content\">\n        <textarea style=\"width: 100%; margin-top: 12px; \" v-model=\"state.cancelTip\" placeholder=\"请输入留言内容\"></textarea>\n      </view>\n    </u-modal>\n    <u-modal\n      v-model=\"state.revokeShow\"\n      :content=\"content\"\n      @confirm=\"handleRevoke\"\n      class=\"revoke\"\n      :contentStyle=\"modalStyle\"\n      @cancel=\"state.revokeShow = false\"\n      :showCancelButton=\"true\"\n      :content-style=\"{border:'none'}\"\n    >\n      <div style=\"padding: 12px;\">\n        <textarea style=\"width: 100%; margin-top: 12px; \" v-model=\"state.revokeMsg\" placeholder=\"请输入留言内容\"></textarea>\n      </div>\n    </u-modal>\n    \n        <!-- 新加减分 -->\n    <u-modal v-model=\"scoreVisible\" :showCancelButton=\"true\"\n      confirm-color=\"#008BFF\" cancel-color=\"#595959\" title=\"请确认变更后是否保留已发生扣分\" :titleStyle=\"{ color: '#262626',fontWeight:600 }\"\n      :contentStyle=\"modalStyle\" @confirm=\"yesScore\" @cancel=\"noScore\">\n      <view class=\"slot-content\" >\n       <view style=\"padding: 15px 0 0 0\">\n        <view class=\"tip-t\">选择<span style=\"color: #3875ff;font-weight: 500;\">确认</span>，代表保留目前已扣除的分数，并通过变更后的任务计划完成日期重新计算延期天数，二者相加可能造成重复扣分。</view>\n        <view class=\"tip-t\">选择<span style=\"color: #3875ff;font-weight: 500;\">取消</span>，代表不保留目前已扣除的分数，系统将根据本次审批的计划完成日期重新判断扣分，不额外加入已扣分数。</view>\n<view class=\"tip-b\">\n  <span style=\"color: #595959;font-weight: 500;\">例：</span>原定4月1日完成的任务延期3天，变更后仍为4月1日完成。确认则对延期3天扣分2次，取消对延期3天扔扣分1次。\n</view>\n       <view class=\"tip-b\">原定4月1日完成的任务延期3天，变更后为4月4日完成未延期。确认仅保留先前延期3天扣分1次，取消后由于4月4日未延期不扣分。</view> \n      </view>\n       </view>\n    </u-modal>\n    <!-- 新加减分 -->",
    });



  // ============================ 属性定义 ============================

  // ---------------------------- 元素数据引用 ----------------------------
  // 组件 自定义模板_uxv7aol0n4 ref 的引用
  const vid_xnninieto7_ref = ref(null);
  // 动态key的map
  const fieldTypeMap = {};
  // 动态key的map
  const refMap = {vid_xnninieto7_ref};

  const showState = reactive({
      vid_xnninieto7_visible: true,
  })
  // ============================ 元素数据引用 ============================

  // ---------------------------- 数据 ----------------------------


  // ============================ 数据 ============================

  // ---------------------------- 方法 ----------------------------
  // ---------------------------- 页面数据 ----------------------------


  // ============================ 页面数据 ============================

  // ---------------------------- 响应 ----------------------------

  // ============================ 响应 ============================

  // ---------------------------- 函数 ----------------------------

  // 自定义函数 返回上一页
  const customFunction_goBack_cuj3m6n0zb =  (...params) => {
    uni.navigateBack()
  }

  // ============================ 函数 ============================

  // ---------------------------- 页面参数 ----------------------------

  const pageParameter_state = reactive({
      'processInstanceId': undefined,
  })

  // ============================ 页面参数 ============================

  // ---------------------------- 组件事件处理方法 ----------------------------


  // ============================ 组件事件处理方法 ============================

  // ============================ 方法 ============================

  // ---------------------------- 生命周期 ----------------------------
  /*** UNI_APP_EXEGESIS ***
      // 获取上一层传递的数据
      const workflowChannel = new BroadcastMessage('WORKFLOW');
      workflowChannel.publish({ status: 'Ready' });
      workflowChannel.subscribe((data) => {
        if (data) {
          isProcessState.value = (window.self !== window.parent && data.type === 'hideHeader');
        }
      });
      *** UNI_APP_EXEGESIS ***/


  const pageScrollTop = ref(0)

  // *** PREVIEW_EXEGESIS ***
  onMounted(() => {
    setPageParams(route.query)
    // 设置表单的rule
    try{

    }catch{
        // do nothing
    }
  });
  // *** PREVIEW_EXEGESIS *** //

  /*** UNI_APP_EXEGESIS ***
  const routeOption = ref({})
  onLoad((option) => {
    routeOption.value = option;
  });
  onReady(() => {
    setPageParams(routeOption.value)
    // 设置表单的rule
    try{

    }catch{
        // do nothing
    }
  });
  // 图表刷新标记
  const uChartsReshowFlag = ref(false);
  onHide(() => { // 页面隐藏后标记置为false(如果不置为false无法触发图表更新)
      uChartsReshowFlag.value = false
  })
  onShow(() => {
      uChartsReshowFlag.value = true; // 页面激活后,标记置为true

      setPageParams(routeOption.value)
  })
  onPageScroll(e => {
      pageScrollTop.value = e.scrollTop
  });
  *** UNI_APP_EXEGESIS ***/

  const setPageParams = (routerParam)=>{
    const pageParams = [{"dataType":"STRING","dependencies":[],"name":"processInstanceId"}];
    const strategyMap = {
      STRING: (param, paramValue) => {
        pageParameter_state[param.name] = paramValue;
      },
      BOOLEAN: (param, paramValue) => {
        if('true' === (paramValue || '').toLowerCase()) {
          pageParameter_state[param.name] = true
        } else if('false' === (paramValue || '').toLowerCase()) {
          pageParameter_state[param.name] = false
        } else {
          // TODO: 是否要支持toast
          console.error('参数传入错误！类型不匹配！');
        }
      },
      NUMBER: (param, paramValue) => {
        if (!isNaN(paramValue)) {
          pageParameter_state[param.name] = Number(paramValue);
        } else {
          // TODO: 是否要支持toast
          console.error('参数传入错误！类型不匹配！');
        }
      },
      ARRAY: (param, paramValue) => {
        if (isNullOrUnDef(paramValue) || !paramValue || paramValue=== 'undefined') { // default value
          pageParameter_state[param.name] = [];
        } else if(paramValue.trim().startsWith('[') && paramValue.trim().endsWith(']')) {
          try {
            pageParameter_state[param.name] = JSON.parse(decodeURI(paramValue));
          } catch (error) {
            console.error('参数解析失败 ',error);
          }
        } else {
          console.error('参数传入错误！类型不匹配！');
        }
      },
    };
    pageParams.forEach((param) => {
      strategyMap[param.dataType](param, routerParam[param.name])
    });


  }

  onUnmounted(() => {
    // 销毁定时器
    setTimeOutList.forEach(({ repeat, timer }) => {
      repeat ?  clearInterval(timer): clearTimeout(timer);
    });
  });


  /*** UNI_APP_EXEGESIS ***
  onPullDownRefresh(() => {
    // 下拉刷新
    setTimeout(() => {
        uni.stopPullDownRefresh()
    }, 1000)
  })
  *** UNI_APP_EXEGESIS ***/

  // ============================ 生命周期 ============================

  // ---------------------------- 数据关联处理 ----------------------------
  // ---------------------------- 组件数据同步 ----------------------------

  // ============================ 组件数据同步 ============================
  //
  // ============================ 数据关联处理 ============================

  // ---------------------- 不同组件自定义的处理逻辑 ---------------------

  // ====================== 不同组件自定义的处理逻辑 ======================


  // ================================定制化逻辑========================================
  onMounted(() => {
    let appDiv = document.querySelector('#app');
    if (appDiv) appDiv.style.background = 'linear-gradient(180deg, #E1EFFD 100%, #ffffff 0%)';
    let topHeader = document.querySelector('.uni-page-head');
    if (topHeader) topHeader.remove()
    let bottomTab = document.querySelector('.vid_dur3o27gyj')
  if(bottomTab) bottomTab.remove()
    // 获取当前 URL 中问号后的参数部分
    const queryString = window.location.search

    // 使用 URLSearchParams 解析参数字符串
    const urlParams = new URLSearchParams(queryString)

    // 遍历参数并输出
    urlParams.forEach((value, key) => {
        console.log(`${key}: ${value}`)
    })
    console.log(route.query,'asdddddddddddddddddddddddddddddddddd');

    // 获取特定参数的值
    const id = urlParams.get('id')
    const type = urlParams.get('type')
    console.log(type,'ty')
    const instanceId = urlParams.get('instanceId')
    const taskId = urlParams.get('taskId')
    const processStatus = urlParams.get('processStatus')
    const status = urlParams.get('status')
    state.id = id
    state.type = type
    state.instanceId = instanceId
    state.taskId = taskId
    state.processStatus = processStatus
    state.status = status
    state.isProject = state.type.endsWith('项目')||state.type === '模版项目-新建' || state.type==='模版项目-编辑';
    state.isEditTask =state.type === '交付任务编辑'||state.type === '编辑交付任务' || state.type==='交付通用/模板项目-任务-编辑';
    state.isCompleteTask = state.type === '完成任务' || state.type === '交付通用/模板项目-任务-完成';
      state.isDaily = state.type === '日报审批' || state.type === '日报审批流' || state.type==='产研交付日报' || state.type==='其他日报' || state.type==='休假申请';
      state.isActionOk = state.type === '完成行动项任务审批' || state.type==='行动项任务-完成'
      state.isEditActionTask = state.type === '编辑行动项任务审批' || state.type==='行动项任务-编辑'
      state.isBatchDelay = state.type === '模板项目-任务-批量延时' || state.type==='批量任务延迟'
    // 新建模板项目/编辑模板项目/删除模板项目
    if (state.isProject) {
      if (state.type.indexOf('编辑') !== -1) {
        state.projectViewList.push({mainTitle: '变更原因', key: 'changeReason', list: []},)
      }
      getProjectDetail()
    } else if (state.isEditTask) {
      getEditTaskDetail();
          getScore()
    } else if (state.isCompleteTask) {
      getCompleteTaskDetail();
    }else if(state.isDaily){
        getDailyDetail()
      }else if(state.isActionOk){
        getCompleteActionTaskDetail();
      }else if(state.isEditActionTask){
        getEditActionTaskDetail();
        getScore()
      }else if(state.isBatchDelay){
        getBatchDelayDetail();
      }
    // 完成任务详情


    // 项目新建 编辑 和 删除

    let warpper = document.querySelector('uni-page-wrapper')
    if (warpper) warpper.style.height = '100%';
  })
  const modalStyle = {
    padding: '15px'
  }
  const content = '确认撤销吗？'
  const state = reactive({
    revokeShow:false,
    revokeMsg:'撤销',
    id: '',
    status:'',
    type: '',
    instanceId: '',
    taskId: '',
    taskName: '',
    projectName: '',
    milepostName: '',
    taskStatus: '',
    priority: '',
    creadBy: '',
    startTime: '',
    endTime: '',
    actualStarTime: '',
    assessorName: '',
    acceptanceCriteria: '',
    taskParticipantStr: '',
    // 附件
    ppmEnclosureInfoList: [],
    confirmShow: false,
    cancelShow: false,
    confirmTip: '',
    cancelTip: '',
    loadingShow: false,
    imageList: [],
    taskRemarks: [],
    okList: [],
    checkList: [],
       sopList:[],
    isProject: false,
    isEditTask: false,
    isCompleteTask: false,
        isDaily:false,
        isActionOk:false,
        isEditActionTask:false,
        isBatchDelay:false,
    projectDetail: {
      changeRecordDtoMap: {
        FIRST_PARTY: {
          afterValue: '[{"firstPartyName":"","role":""}]',
          beforeValue: '[{"firstPartyName":"","role":""}]',
          changed: false
        },
        COMMERCIAL_ENCLOSURE_INFO: {
          afterValue: '[{"imgUrl":"","name":"商务合同","size":0,"status":"done","type":"","uid":"","url":""}]',
          changed: false
        },
        SOW: {
          afterValue: '[{"imgUrl":"","name":"SOW","size":0,"status":"done","type":"","uid":"","url":""}]',
          changed: false
        },
        BUDGET_ENCLOSURE: {
          afterValue: '[{"imgUrl":"","name":"预算表","size":0,"status":"done","type":"","uid":"","url":""}]',
          changed: false
        },
        PROJECT_TEMPLATE: {changed: false},
        FACTORY_NAME: {changed: false},
        PROJECT_PRIORITY: {changed: true},
        PROJECT_START_TIME: {changed: true},
        KICKOFF_MEETING_START_DATE: {changed: false},
        TASK_STATUS: {changed: false},
        ACCEPTANCE_TIME: {changed: false},
        VICE_PRESIDENT: {changed: false},
        PROJECT_DIRECTOR: {changed: false},
        PM: {changed: false},
      }
    },
    editTaskDetail: {
      changeRecordDtoMap: {}
    },
    editActionTaskDetail:{},
    batchDelayDetail:{},
    itemStyle: {
      borderBottom: '2rpx solid #EBEBEB',
    },
    projectViewList: [
      {
        mainTitle: '基本信息',
        list: [
          {
            title: '审批类型',
            collapse: false,
            key: 'approveType'
          },
          {title:'项目模板', collapse: true, key: 'PROJECT_TEMPLATE'},
          {title:'工厂名称', collapse: true, key: 'FACTORY_NAME'},
          {title:'项目关联菜单', collapse: true, key: 'PROJECT_DIRECTORY'},
          {title:'项目优先级', collapse: true, key: 'PROJECT_PRIORITY'},
          {title:'项目开始时间', collapse: true, key: 'PROJECT_START_TIME'},
          {title:'启动会开始时间', collapse: true, key: 'KICKOFF_MEETING_START_DATE'},
          {title:'计划初验时间', collapse: true, key: 'TASK_STATUS'},
          {title:'计划终验时间', collapse: true, key: 'ACCEPTANCE_TIME'},
          {title:'提交人', collapse: false, key: 'submitter'},
          {title:'提交时间', collapse: false, key: 'submitTime'},
        ]
      },
      {mainTitle: '项目领导小组', list: [{title: '副总裁', collapse: true, key: 'VICE_PRESIDENT'}]},
      {mainTitle: '项目负责人', list: [
          {title: 'PMO', collapse: true, key: 'PMO'},
          {title: '项目总监', collapse: true, key: 'PROJECT_DIRECTOR'},
          {title: '项目经理', collapse: true, key: 'PM'},
        ]},
      {mainTitle: '项目组核心成员', list: [
          {title: '商务经理', collapse: true, key: 'PRE_SALE_MANAGER'},
          {title: '数据实施总监', collapse: true, key: 'DATA_IMPLEMENTATION_DIRECTOR'},
          {title: '数据治理工程师', collapse: true, key: 'DATA_GOVERNANCE_ENGINEER'},
          {title: '算法专家', collapse: true, key: 'ALGORITHM_EXPERT'},
          {title: '交付经理', collapse: true, key: 'DELIVERY_MANAGER'},
          {title: '产品经理', collapse: true, key: 'PRODUCT_LEADER_NAME'},
          {title: '技术经理', collapse: true, key: 'DEVELOP_LEADER_NAME'},
          {title: '测试经理', collapse: true, key: 'TEST_LEADER_NAME'},
        ]},
      {mainTitle: '甲方信息', key: 'FIRST_PARTY', list: []},
      {mainTitle: '附件', list: [
          {title: 'SOW', collapse: false, key: 'SOW'},
          {title: '商务合同', collapse: false, key: 'COMMERCIAL_ENCLOSURE_INFO'},
          {title: '预算表', collapse: false, key: 'BUDGET_ENCLOSURE'},
        ]},
      {mainTitle: '预算信息', list: [
          {title: '项目总预算', collapse: true, key: 'BUDGET'},
          {title: '人力成本预算', collapse: true, key: 'HUMAN_COST_BUDGET'},
          {title: '直接费用预算', collapse: true, key: 'DIRECT_EXPENSE_BUDGET'},
        ]},
      {mainTitle: '备注', key: 'remarks', list: [
          {title: '', collapse: true, key: 'PROJECT_REMARKS'},
        ]},
    ],
    editTaskList: [
      {title:'审批类型', collapse: false, key: 'approveType'},
      {title:'任务名称', collapse: true, key: 'TASK_NAME'},
      {title:'项目名称', collapse: true, key: 'PROJECT_NAME'},
      {title:'项目阶段', collapse: true, key: 'MILEPOST_NAME'},
      {title:'任务状态', collapse: true, key: 'TASK_STATUS'},
      {title:'优先级', collapse: true, key: 'TASK_PRIORITY'},
      {title:'计划开始时间', collapse: true, key: 'TASK_START_TIME'},
      {title:'计划结束时间', collapse: true, key: 'TASK_END_TIME'},
      {title:'计划工时', collapse: true, key: 'TASK_WORK_HOURS'},
      {title:'实际工时', collapse: true, key: 'TASK_ACTUAL_WORK_HOURS'},
      {title:'工时投入状态', collapse: true, key: 'TASK_STATE_INPUT'},
      {title:'任务负责人', collapse: true, key: 'TASK_OWNER'},
      {title:'审核员', collapse: true, key: 'TASK_ASSESSOR'},
      {title:'任务参与人', collapse: true, key: 'TASK_PARTICIPANT'},
      {title:'提交人', collapse: false, key: 'submitter'},
      {title:'提交时间', collapse: false, key: 'submitTime'},
      {title:'备注', collapse: true, key: 'TASK_REMARKS'},
      {title:'变更原因', collapse: false, key: 'changeReason'},
    ],
    editActionTaskList: [
      {title:'审批类型', collapse: false, key: 'approveType'},
      {title:'行动项任务名称', collapse: true, key: 'ACTION_TASK_NAME'},
      {title:'项目名称', collapse: true, key: 'PROJECT_NAME'},
      {title:'任务状态', collapse: true, key: 'TASK_STATUS'},
      {title:'计划开始时间', collapse: true, key: 'TASK_START_TIME'},
      {title:'计划结束时间', collapse: true, key: 'TASK_END_TIME'},
      {title:'实际工时', collapse: true, key: 'TASK_ACTUAL_WORK_HOURS'},
      {title:'任务负责人', collapse: true, key: 'TASK_OWNER'},
      {title:'审核员', collapse: true, key: 'TASK_ASSESSOR'},
      {title:'PMO', collapse: true, key: 'PMO'},
      {title:'任务执行人', collapse: true, key: 'TASK_PARTICIPANT'},
      {title:'提交人', collapse: false, key: 'submitter'},
      {title:'提交时间', collapse: false, key: 'submitTime'},
      {title:'备注', collapse: true, key: 'TASK_REMARKS'},
      {title:'变更原因', collapse: false, key: 'changeReason'},
      {title:'完成标准', collapse: true, key: 'FINISH_STANDARD'},
    ],
    completeActionTaskDetail:{}

  })
  const firstBorderStyle = computed(() => {
    return (index, length) => {
      return {
        borderBottom: `2rpx solid ${index !== length ? '#EBEBEB' : '#9BBAFF'}`,
      }
    }
  })
  const getProjectDetailByKey = computed(() => {
    return (key, subKey = 'afterValue') => {
      if (subKey === 'changed') {
        return state.projectDetail.changeRecordDtoMap?.[key]?.[subKey];
      }
      if (['FIRST_PARTY', 'COMMERCIAL_ENCLOSURE_INFO', 'SOW', 'BUDGET_ENCLOSURE'].includes(key)) {

        return JSON.parse(state.projectDetail.changeRecordDtoMap?.[key]?.[subKey] ?? '[]')
      }
      return state.projectDetail.changeRecordDtoMap?.[key]?.[subKey] ?? '';

    }
  })

  const getEditTaskByKey = computed(() => {
    return (key, subKey = 'afterValue') => {
      if (subKey === 'changed') {
        return !!state.editTaskDetail?.changeRecordDtoMap?.[key]?.[subKey];
      }

      return state.editTaskDetail.changeRecordDtoMap?.[key]?.[subKey] ?? '';

    }
  })
  
  const getEditActionTaskByKey = computed(() => {
    return (key, subKey = 'afterValue') => {
      if (subKey === 'changed') {
        return !!state.editActionTaskDetail?.changeRecordDtoMap?.[key]?.[subKey];
      }
      return state.editActionTaskDetail.changeRecordDtoMap?.[key]?.[subKey] ?? '';

    }
  })

  function handleAgree() {
    state.confirmShow = true
  }
  function handleCancel() {
    state.cancelShow = true
  }
  function handleConfirm() {
    console.log('同意');
    state.loadingShow = true
    const params = {
      approveAction: "APPROVE",
      approveRemark: state.confirmTip,
      processInstanceId: state.instanceId,
      taskId: state.taskId
    }
    put('/workflow-platform/api/v1/process_instance/task/approve', params).then(data => {
      if (data.status === 'success') {
        uni.showToast({
          title: '操作成功',
          icon: 'success',
        });
        handleRedirect(`/pages/Page3000000258/Page3000000258`)
      } else {
        uni.showToast({
          title: data.errorMsg,
          icon: 'error',
        });
      }
    }).finally(() => {
      state.confirmShow = false
      state.loadingShow = false
    });

  }
  function handleReject() {
    state.loadingShow = true
    // 拒绝接口
    const params = {
      approveAction: "REJECT",
      approveRemark: state.cancelTip,
      processInstanceId: state.instanceId,
      taskId: state.taskId
    }
    put('/workflow-platform/api/v1/process_instance/task/approve', params).then(data => {
      if (data.status === 'success') {
        uni.showToast({
          title: '操作成功',
          icon: 'success',
        });
        handleRedirect(`/pages/Page3000000258/Page3000000258?`)
      } else {
        // 处理错误，例如显示错误信息给用户或记录日志
        uni.showToast({
          title: data.errorMsg,
          icon: 'none',
        });
      }


    }).finally(() => {
      state.cancelShow = false
      state.loadingShow = false
    })

  }
  function bCancel(){
    state.cancelShow = false
    state.cancelTip = ''
  }
  function aCancel(){
    state.confirmShow = false
    state.confirmTip = ''
  }
  function previewImage(image) {
    // 过滤出是图片的URL
    const urlsArray = state.ppmEnclosureInfoList
      .filter(item => isImage(item.url))
      .map(item => item.url);

    state.imageList = image;
    uni.previewImage({
      current: image, // 当前显示图片的链接，需与image标签中src一致
      urls: urlsArray // 需要预览的图片链接列表
    });
  }
  function isImage(url) {
    return /\.(jpg|jpeg|png|gif|bmp|svg)$/i.test(url);
  }
  function hasImageInList() {
    return state.ppmEnclosureInfoList.some(item => isImage(item.url));
  }

  // 完成任务审批
    const getCompleteTaskDetail = () => {
      post('/solution-ppm/api/v2/built-in-system-ppm/delivery_task/search/batch_query', {
  projectName:'',
  projectId:'',
  taskIdList:[state.id]
  }).then(({ data }) => {
        state.projectName = data[0].projectName
        state.milepostName = data[0].milepostName
        get(`/workflow-platform/api/v1/process_instance/detail/${state.instanceId}/${state.taskId}`).then(({ data }) => {
          state.creadBy = data.processTaskList[0].assignUserName
          state.lastModifiedDate = data.processTaskList[0].lastModifiedDate
          get(`/solution-ppm/api/v2/built-in-system-ppm/delivery_task/${state.id}/queryAttachment  `).then(({ data }) => {
            state.taskName = data.taskName
            state.startTime = data.startTime
            state.endTime = data.endTime
            state.actualStarTime = data.actualStarTime
            state.workingHours = data.workingHours
            state.actualWorkHours = data.actualWorkHours
            state.stateInput = data.stateInput
            state.assessorName = data.assessorName
            state.taskParticipantStr = data.taskParticipantStr
            state.acceptanceCriteria = data.acceptanceCriteria
            if (data.priority === 'HIGH') {
              state.priority = '高'
            } else if (data.priority === 'HIGHEST') {
              state.priority = '最高'
            } else if (data.priority === 'MEDIUM') {
              state.priority = '中'
            } else if (data.priority === 'LOW') {
              state.priority = '低'
            } else if (data.priority === 'LOWEST') {
              state.priority = '最低'
            }
            state.taskStatus = data.taskStatus
            state.taskRemarks = data.taskRemarks?.split("；").map(function(item) {
              return item.trim();
            });
            console.log(state.taskRemarks,'state.taskRemarks');
            state.ppmEnclosureInfoList = data.ppmEnclosureInfoList
            get(`/solution-ppm/api/v2/built-in-system-ppm/changeRecord/${state.instanceId}/standard`).then(data => {
              state.okList = data.data.filter(item => item.type === "完成标准");
              state.checkList = data.data.filter(item => item.type === "审核标准"||item.type === "注意事项");
              state.sopList = data.data.filter(item => item.type === "sop");
            })
          })
        })
      })

    }

  // 编辑任务审批
  const getEditTaskDetail = () => {
    get(`/solution-ppm/api/v2/built-in-system-ppm/dashboard/approve/task/${state.instanceId}`).then(({ data }) => {
      console.log('编辑任务审批', data);
      state.editTaskDetail = data;
    })
  }

  // 项目新建 编辑 和 删除审批
  const getProjectDetail = () => {
    get(`/solution-ppm/api/v2/built-in-system-ppm/dashboard/approve/project/${state.instanceId}`).then(({ data }) => {
      console.log('项目新建 编辑 和 删除审批', data);
      state.projectDetail = data;
      if (!state.projectDetail.changeRecordDtoMap.FIRST_PARTY.afterValue || state.projectDetail.changeRecordDtoMap.FIRST_PARTY.afterValue === '[]') {
        state.projectDetail.changeRecordDtoMap.FIRST_PARTY = {
          afterValue: '[{"firstPartyName":"","role":""}]',
          beforeValue: '[{"firstPartyName":"","role":""}]',
        }
      }
      if (!state.projectDetail.changeRecordDtoMap.SOW.afterValue || state.projectDetail.changeRecordDtoMap.SOW.afterValue === '[]') {
        state.projectDetail.changeRecordDtoMap.SOW = {
          afterValue: '[{"imgUrl":"","name":"","size":0,"status":"done","type":"","uid":"","url":""}]'
        }
      }
      if (!state.projectDetail.changeRecordDtoMap.COMMERCIAL_ENCLOSURE_INFO.afterValue || state.projectDetail.changeRecordDtoMap.COMMERCIAL_ENCLOSURE_INFO.afterValue === '[]') {
        state.projectDetail.changeRecordDtoMap.COMMERCIAL_ENCLOSURE_INFO = {
          afterValue: '[{"imgUrl":"","name":"","size":0,"status":"done","type":"","uid":"","url":""}]'
        }
      }
      if (!state.projectDetail.changeRecordDtoMap.BUDGET_ENCLOSURE.afterValue || state.projectDetail.changeRecordDtoMap.BUDGET_ENCLOSURE.afterValue === '[]') {
        state.projectDetail.changeRecordDtoMap.BUDGET_ENCLOSURE = {
          afterValue: '[{"imgUrl":"","name":"","size":0,"status":"done","type":"","uid":"","url":""}]'
        }
      }
    })
  }

  const handleDownLoadFile = (info) => {
    let xhr = new XMLHttpRequest();
    xhr.open('GET', info.url, true);
    xhr.responseType = 'blob';
    xhr.onload = function () {
      if (xhr.status === 200) {
        let link = document.createElement('a');
        let body = document.querySelector('body');
        link.href = window.URL.createObjectURL(xhr.response);
        link.download = info.name;
        // fix Firefox
        link.style.display = 'none';
        body.appendChild(link);
        link.click();
        body.removeChild(link);
        window.URL.revokeObjectURL(link.href);
      }
    };
    xhr.send();
    console.log(info);
    // uni.downloadFile({
    //   url: info.url,
    //   success: (res) => {
    //     if (res.statusCode === 200) {
    //       console.log('下载成功');
    //     }
    //   }
    // });
  }
  function handleRevokeShow(){
    state.revokeShow = true
  }
  function handleRevoke(){
    put(`/workflow-platform/api/v1/process_instance/revoke/${state.instanceId}`,{revokeReason:state.revokeMsg}).then(data=>{
      if(data.status==='success'){
        uni.showToast({
          title: '操作成功',
          icon: 'success',
        });
        handleRedirect(`/pages/Page3000000258/Page3000000258`)
      }else{
        uni.showToast({
          title: data.errorMsg||'撤销失败',
          icon: 'none',
        });
      }
    })
  }

  // 新-加减分
    const scoreSource = ref([])
    const scoreVisible = ref(false)
    function getScore(){
      if(!state.isEditActionTask){
        post('/solution-ppm/api/v2/built-in-system-ppm/delivery_task/task_affect_performance_list',{processInstanceId:state.instanceId}).then(data=>{
        if(data.code===200){
          scoreSource.value = data.data.ppmTaskScoreChangeConfigureDtoList
        }else{
          uni.showToast({
            title: '获取加减分详情失败',
            icon: 'error',
          });
        }
      })
      }else{
      post(`/solution-ppm/api/v2/built-in-system-ppm/action_task_approve/update/${state.instanceId}`).then(data=>{
        if(data.code===200){
          scoreSource.value = data.data.ppmTaskPointsList
        }else{
          uni.showToast({
            title: '获取加减分详情失败',
            icon: 'error',
          });
        }
      })
      }
     
    }
    const currentScore = ref({})
    function addOrReduction(item){
      scoreVisible.value = true;
      currentScore.value = item
    }
    const scoreParams = ref(

       { affectPerformance:'',
        ppmTaskScoreChangeConfigureId:undefined,
        processInstanceId:undefined}

    )
    function confirmScore(){
      if(!state.isEditActionTask){
        post('/solution-ppm/api/v2/built-in-system-ppm/delivery_task/task_affect_performance',scoreParams.value).then(data=>{
        if(data.code===200){
          scoreVisible.value = false
          getScore()
        }
      })
      }else{
        post('/solution-ppm/api/v2/built-in-system-ppm/action_task_approve/task_affect_performance',scoreParams.value).then(data=>{
        if(data.code===200){
          scoreVisible.value = false
          getScore()
        }
      })
      }
     
    }
    function yesScore(){
      scoreParams.value.affectPerformance = '是'
      scoreParams.value.processInstanceId = state.instanceId
      scoreParams.value.ppmTaskScoreChangeConfigureId = currentScore.value.id

      confirmScore()
    }
    function noScore(){
      scoreParams.value.processInstanceId = state.instanceId
      scoreParams.value.ppmTaskScoreChangeConfigureId = currentScore.value.id
      scoreParams.value.affectPerformance = '否'
      confirmScore()
    }

    //新- 日报审批详情

          const dailyState = ref([])
          const projectDailyState = ref([])
          const otherState = ref([])
          const leaveState = ref([])
              function getDailyDetail(){
        post(`/solution-ppm/api/v2/built-in-system-ppm/daily/approval-process-search/${state.instanceId}/by_classify`).then(data=>{
          dailyState.value =data.data.taskDailyList
          projectDailyState.value =data.data.projectDailyList
          otherState.value =data.data.otherDailyList
          leaveState.value =data.data.otherDailyList
        })
            }
            // 完成行动项任务详情
            function getCompleteActionTaskDetail(){
              get(`/solution-ppm/api/v2/built-in-system-ppm/action_task_approve/${state.instanceId}`).then(data=>{
                state.completeActionTaskDetail=data.data
                console.log(state.completeActionTaskDetail);
              })
            }
            // 编辑行动项任务详情
            function getEditActionTaskDetail(){
              get(`/solution-ppm/api/v2/built-in-system-ppm/dashboard/approve/action_task/${state.instanceId}`).then(data=>{
                state.editActionTaskDetail = data.data;
              })
            }
            // 批量延时审批详情
           function getBatchDelayDetail(){
            get(`/solution-ppm/api/v2/built-in-system-ppm/delivery_task/task_batch_delay/${state.instanceId}`).then(data=>{
                state.batchDelayDetail = data.data;
              })
           }
</script>
<style lang="less" scoped>
  .page_root {
      min-height: 100%;
      box-sizing: border-box;
  }


  .page_root {
        min-height: 100%;
        box-sizing: border-box;
        overflow: hidden;
        background: linear-gradient(180deg, #E1EFFD 100%, #ffffff 0%);
      }

      .main {
        height: 100%;
        background: linear-gradient(180deg, #E1EFFD 100%, #ffffff 0%);
        padding: 15px 15px 15px 15px;
        position: relative;
        overflow: auto;
      }

      .bgc-img {
        position: absolute;
        width: 100%;
        height: 300px;
        left: 0;
        top: -180px;
        // background-image: url('@/static/images/b30897b8627382dcffa568166e0e9596.png');
        background-size: cover;
      }

      .detail-content {
        background: #FFFFFF;
        border-radius: 4px;
        position: relative;
        padding: 0 15px 15px 15px;
        position: relative;
      }
      .mb-15 {
        margin-bottom: 30rpx;
      }
    .detail-content.complete-wrapper .detail-item {
      border-bottom: 2rpx solid #EBEBEB;
    }
      .detail-content .border-left {
        color: #262626;
        font-weight: bolder;
        position: relative;
        padding-left: 20rpx;

      }
      .border-left::before {
        content: '';
        position: absolute;
        left: 0;
        top: 20rpx;
        width: 8rpx;
        height: 34rpx;
        background-color: #3875FF;
      }
      .detail-item {
        min-height: 40px;
        line-height: 40px;
        display: flex;
        width: 100%;
      }

      .ellipsis {
        width: 80% !important;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        word-break: keep-all;
      }
    .detail-item.border {
      border-bottom: 2rpx solid #EBEBEB;
    }

      .detail-content :deep(.u-collapse-head) {
        padding: 0;
      }

      .detail-content :deep(.u-iconfont) {
        color: #3875FF !important;
      }
      .detail-content :deep(.u-arrow-down-icon) {
        margin: 0 4rpx;
      }

      .before-style {
        background: rgba(0,0,0,0.05);
        border-radius: 2px;
        padding: 10rpx 20rpx;
        margin-bottom: 12rpx;
        font-size: 26rpx;
        color: #8C8C8C;
      }

      .view-text {
        min-height: 20rpx;
        font-size: 14px;
        color: #262626;
        font-weight: 600;
        margin-top: 10rpx;
        word-break: break-all;
        line-height: 1.4;
      }
      .first-border {
        border-bottom-color: #9BBAFF;
      }
      .ok-item {
        min-height: 40px;
        line-height: 40px;
        border-bottom: 1px solid #EBEBEB;
      }

      .detail-left {
        width: 45%;
        font-family: PingFangSC-Regular;
        font-size: 14px;
        color: #595959;
        letter-spacing: 0;
        line-height: 40px;
        font-weight: 400;
      }

      .detail-right {
        flex: 1;
        font-family: PingFangSC-Semibold;
        font-size: 14px;
        color: #262626;
        letter-spacing: 0;
        text-align: right;
        line-height: 40px;
        font-weight: 600;
      }

      .fixed-button {
        bottom: 10px;
        left: 0;
        width: 100%;
        color: #fff;
        text-align: center;
        border: none;
        border-radius: 0;
        display: flex;
        margin: 0 auto;
        justify-content: space-between;
      }

      .agree-btn {
        width: 47%;
        height: 32px;
        line-height: 32px;
        background: #52C41A;
        border-radius: 4px;
        color: #fff;
        display: inline-block;
      }

      .cancle-btn {
        width: 47%;
        line-height: 32px;
        height: 32px;
        background: #FF4D4F;
        border-radius: 4px;
        display: inline-block;
      }

      .img-content {
        margin-bottom: 15px;
      }

      .img-content-item {
        width: 100px;
        height: 100px;
        /* 计算每个项目的宽度，每行最多三个 */
        padding: 5px;
        /* 设置间距，可根据需要调整 */
        box-sizing: border-box;
        margin-bottom: 10px;
        /* 计算边距在内 */
      }

      .image-container {
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;
      }

      .image-every {
        width: 100%;
        height: auto;
        display: block;
      }


      .ok-item-tip,
      .check-item-tip {
        font-family: PingFangSC-Regular;
        font-size: 14px;
        color: #262626;
        letter-spacing: 0;
        font-weight: 400;
        line-height: 2;
      }

      .slot-content {
        position: relative;
        top: -15px;
      }

      :global(.u-model__footer__button) {
        border-left: 1px solid #d9d9d9;
        line-height: 44px !important;
      }

      :global(.u-model__title) {
        height: 44px;
        line-height: 0px;
        border-bottom: 1px solid #d9d9d9;
      }

      :global(.u-model__footer) {
        height: 44px;
        border-top: 1px solid #d9d9d9;

      }
      :global(.uni-textarea-compute) {
        color: #52C41A !important;

      }
      :global(.uni-textarea-textarea) {
        color: #262626;
      }

      .line-bottom{
        width: 100%;
        height: 1px;
        border: 1px solid #EBEBEB;
      }
     .revoke-btn{
          height: 32px;
          line-height: 32px;
          width: 100%;
          background: #FF4D4F;
  border-radius: 4px;
  text-align: center;
  font-family: PingFangSC-Medium;
  font-size: 14px;
  color: #FFFFFF;
  letter-spacing: 0;
  font-weight: 500;
        }
        :deep(.revoke .u-model__title){
          border: none;
        }
        :deep(.revoke .u-model__footer){
          border: none;
        }
        :deep(.revoke .u-model__footer__button){
          border: none;
        }

  /*
          加减分详情
          */

  .score-title{
    height: 45px;
    border-bottom: 1px solid #D9D9D9;
    line-height: 45px;
    font-size: 14px;
    color: #262626;
    font-weight: 600;
  }
  .score-item{
    padding: 0 15px;
    border-bottom:  1px solid #9BBAFF;
  }
  .score-item-line{
    width: 100%;
    height: 45px;
    display: flex;
    border-bottom: 1px solid #EBEBEB;
  }
  .score-item-left{
    width: 45%;
    font-family: PingFangSC-Regular;
  font-size: 14px;
  color: #595959;
  letter-spacing: 0;
  line-height: 40px;
  font-weight: 400;
  }
  .score-item-right{
    flex:1;
    font-family: PingFangSC-Semibold;
  font-size: 14px;
  color: #262626;
  letter-spacing: 0;
  text-align: right;
  line-height: 40px;
  font-weight: 600;
  }
  .yes-no{
    font-family: PingFangSC-Semibold;
  font-size: 14px;
  color: #3875FF;
  letter-spacing: 0;
  text-align: right;
  font-weight: 600;
  }
  .tip-t{
    font-family: PingFangSC-Regular;
  font-size: 14px;
  color: #262626;
  letter-spacing: 0;
  text-align: justify;
  line-height: 20px;
  font-weight: 400;
  margin-bottom: 4px;
  }
  .tip-b{
    font-family: PingFangSC-Regular;
  font-size: 14px;
  color: #595959;
  letter-spacing: 0;
  text-align: justify;
  font-weight: 400;
  margin-bottom: 4px;
  }
  .detail-content.batch-deily .detail-item {
      border-bottom: 2rpx solid #EBEBEB;
    }
    .one-line{
      min-height: 40px;
        line-height: 40px;
        width: 100%;
      text-align: center;
      border-bottom: 2rpx solid #EBEBEB;
    }
    .before{
      color: #8C8C8C
    }
</style>
